package com.kx.springmybatis.pojo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName User
 * @Author Sun
 * @Date 2021/5/17 20:06
 */
//@Scope("prototype")
@Component//自动创建对象的注解, 会给对象默认分配一个 id, 当前类名的首字母小写
public class User {

    @Value("张三")
    private String name;
    @Value("18")
    private int age;
    @Autowired  //自动注入注解,会按照类型进行注入,也可以写在set方法上
    private Order order;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", order=" + order +
                '}';
    }
}
